UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3JtM8f6KxuI6VZvlAyOsJsl00qE01lTcGomQ5TSxm+8=' 
WHERE 
  key_id = 'aa0014980fdf505aff69e0287b678b5c443a5633c05fd2e6042a5cf11f7f3382' 
  AND (
    token = '3JtM8f6KxuI6VZvlAyOsJsl00qE01lTcGomQ5TSxm+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040