UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2IdUGbE92k+Ptu1ESPeOUre7MIFsfh5wimMkmHn+kJ8=' 
WHERE 
  key_id = '523e31daef407d935b9f3b172a89c8f990faf28be11abe1bf62e51b3844f4942' 
  AND (
    token = '2IdUGbE92k+Ptu1ESPeOUre7MIFsfh5wimMkmHn+kJ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044