UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F/0sBbXsVa1RKaRAx6HPafV5fnvn3DurFhOVmLQcYzQ=' 
WHERE 
  key_id = 'd2ebc977e1ac6363d923fde6967de1cd7990bd82a21c588b57f99d781fc09fe3' 
  AND (
    token = 'F/0sBbXsVa1RKaRAx6HPafV5fnvn3DurFhOVmLQcYzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036