UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm5Xw7rOmkN/XX+asu5yBowZj5Y4KfBJHUKUXbVwyg8g=' 
WHERE 
  key_id = 'c9cb835ef3d68b747b248da59602619feb2677ab7f606e80eb3d109b65439781' 
  AND (
    token = 'm5Xw7rOmkN/XX+asu5yBowZj5Y4KfBJHUKUXbVwyg8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030