UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4/O1wvUnFUP650FX1frjtfIvVXyXbKZAU94snfHw50g=' 
WHERE 
  key_id = 'd79b4d70d248d5a79f800196df03083aa3289129cbaec96150ee639e61aae635' 
  AND (
    token = '4/O1wvUnFUP650FX1frjtfIvVXyXbKZAU94snfHw50g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026