UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'htmVxri1h3toYn464O9Mc1tkDXkbqI07fIXLltA1qFg=' 
WHERE 
  key_id = 'ffd8618c33dd3d4329e7af736a5e8e51aa71280df30dc741f25b46d59dc1e188' 
  AND (
    token = 'htmVxri1h3toYn464O9Mc1tkDXkbqI07fIXLltA1qFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047