UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tbf2D/GXVh18G9MRy9HwNJ/xLRpZr9aN6Kk6lLXgKf4=' 
WHERE 
  key_id = '076c47aa7973a4f3502b48607b6135d7f761cd3e92152a728c5c3bd1b8ee6adb' 
  AND (
    token = 'Tbf2D/GXVh18G9MRy9HwNJ/xLRpZr9aN6Kk6lLXgKf4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044