UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VAB028aq2UpEYHfi0Q1QQhuOC6EviWE0XzVf2HJJxR0=' 
WHERE 
  key_id = '522d1b2a64d4634df666c6b1d02efb238e5a103aea013e9735578f9528887a71' 
  AND (
    token = 'VAB028aq2UpEYHfi0Q1QQhuOC6EviWE0XzVf2HJJxR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059