UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LJAzCV1Se1kkFBsiqpGdEg35sbhYjAwc2Ui/wyGrqYY=' 
WHERE 
  key_id = '24b87263117da42f5b8cdf1ce13eb65ed4a48fa71e397af62b07f0a1822d27c3' 
  AND (
    token = 'LJAzCV1Se1kkFBsiqpGdEg35sbhYjAwc2Ui/wyGrqYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045