UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vOR1X7FCEK750nDaPSAj/i9bpNq/hC3y4WIzU8YA7gg=' 
WHERE 
  key_id = '8234d932271aa3673526bef4e16408de5c22ebe9115f9e88f2d145af8f26c302' 
  AND (
    token = 'vOR1X7FCEK750nDaPSAj/i9bpNq/hC3y4WIzU8YA7gg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050