UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x2NW0DzXhAJX0wWsCySRvdpA9F+IvmUKFCylM1PW+2U=' 
WHERE 
  key_id = '317aca9bd7771c2a42cec1b8ac81953d7a44086f797e74801191a36683f8acc7' 
  AND (
    token = 'x2NW0DzXhAJX0wWsCySRvdpA9F+IvmUKFCylM1PW+2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019