UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EmeTveye+H4IDVLtNVNvf+6vBACcAee3g+kIvS3nimk=' 
WHERE 
  key_id = '4ffe7a156bdbda69232d26ae96d0fa3abcde8566f82cb50e52f792ecdacf3266' 
  AND (
    token = 'EmeTveye+H4IDVLtNVNvf+6vBACcAee3g+kIvS3nimk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022