UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p6cJpDcOdqtc2p9Nnsai4CuY5a9dphtWJCmXOKV8uTU=' 
WHERE 
  key_id = '738e962c32c6803cbad62eb482a0dea6116cbd16aa34324817ecd340f458e58d' 
  AND (
    token = 'p6cJpDcOdqtc2p9Nnsai4CuY5a9dphtWJCmXOKV8uTU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033