UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UbYOoY5MMmNx1/StlhGj8E0x+U3/ySh+u96CKAf1PQ8=' 
WHERE 
  key_id = '054004e7153f33578623998d293b8279a7421e6ddf68624fe8ab441637473507' 
  AND (
    token = 'UbYOoY5MMmNx1/StlhGj8E0x+U3/ySh+u96CKAf1PQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030