UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yC1XKGYSPwF+5fc6ti/Xpir0d7X8hYGM8vwDNxm5WXA=' 
WHERE 
  key_id = '339484046089d1b57f91623283f5d5c636de0ff4d00e56a7d801b828ab081004' 
  AND (
    token = 'yC1XKGYSPwF+5fc6ti/Xpir0d7X8hYGM8vwDNxm5WXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016