UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ApJjyD5vJNmm3MXqRGvVt99fsDY0VCQuXCHoBwmtpcs=' 
WHERE 
  key_id = '108929fec81088956f4ebf2885b42b9be445ebd5ff9632095b5700460c35b36b' 
  AND (
    token = 'ApJjyD5vJNmm3MXqRGvVt99fsDY0VCQuXCHoBwmtpcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028