UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rmp3G0JZaD09i8bY2bcvYfp0X4ukAkWpN5E2s1p4WNE=' 
WHERE 
  key_id = '132bb2c996465e30344410b317d225dc4a20e614cdbafb83797a95eda4bfbfde' 
  AND (
    token = 'Rmp3G0JZaD09i8bY2bcvYfp0X4ukAkWpN5E2s1p4WNE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027