UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x9P20P4g0+CaiNjzuBQuBnm+5n0ad+Cy8NotXt7FnKA=' 
WHERE 
  key_id = '97be417b554168085eb8ad64e3d3e2164b5236646907c3133c02fc9a3392c95c' 
  AND (
    token = 'x9P20P4g0+CaiNjzuBQuBnm+5n0ad+Cy8NotXt7FnKA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032