UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hLyHhGSX/eA/PBZtcLv1thkxN1KM0YDxv3WM8Uvsd6E=' 
WHERE 
  key_id = '1bdf3b4d91446f09367d08976864723187293399da70a9a2789d3e9b773aaa2e' 
  AND (
    token = 'hLyHhGSX/eA/PBZtcLv1thkxN1KM0YDxv3WM8Uvsd6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031