UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hlmwie5nJPCPiNWc/03QGEtIenMt2T8MPGmbeuEjDbQ=' 
WHERE 
  key_id = '678f44f728c0f474771d7c017ce2dcc14408c976594876ec59f232a2cb41427d' 
  AND (
    token = 'Hlmwie5nJPCPiNWc/03QGEtIenMt2T8MPGmbeuEjDbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038