UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4xXwRJSejhaPcv0358jnSveZCt02P5eokqXC2dXjLpo=' 
WHERE 
  key_id = 'a9226228d05404c66bea4c656f42599553a282a2d638a952499298549418411c' 
  AND (
    token = '4xXwRJSejhaPcv0358jnSveZCt02P5eokqXC2dXjLpo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045