UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VZ8GPkfYHcN2FytIGUMyrkSFknDUfG8oF+nii1TpwPg=' 
WHERE 
  key_id = '8c234e5b590f27243dba26381f3a8a318c10fd6d754dee7034a5780774f8251c' 
  AND (
    token = 'VZ8GPkfYHcN2FytIGUMyrkSFknDUfG8oF+nii1TpwPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049