UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sBZe6/CG4SoW6gnkFIsXluxFvBdcyDIGlA1mdPnKX8g=' 
WHERE 
  key_id = '6eb80f4de8615417132871814130964fac7106ec8a2da95e6533476fc7422d0e' 
  AND (
    token = 'sBZe6/CG4SoW6gnkFIsXluxFvBdcyDIGlA1mdPnKX8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054