UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GLxzB16GosDIxO8bMdC5gyGB50Dm11xW2icFiQgOk+U=' 
WHERE 
  key_id = '523d5fdd58301f37e110f286375c246d2927177e5ba75ee51cd9242abf748f99' 
  AND (
    token = 'GLxzB16GosDIxO8bMdC5gyGB50Dm11xW2icFiQgOk+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032