UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G8GkK5anE0OsaXbzCgMi6bdystQJ0dOvrrE4FWMs6QY=' 
WHERE 
  key_id = '62f5423f4b1235567219549dad6dac6a3249ac63a8ce41d5dd82b31bdc4d635d' 
  AND (
    token = 'G8GkK5anE0OsaXbzCgMi6bdystQJ0dOvrrE4FWMs6QY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041