UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lqGq9zC7RYJc33fw0jmN/1IRJHBOtlZxuRFgmQpbGRY=' 
WHERE 
  key_id = 'a984fc601e862509155d7bb060fe44ee37a7beded204bdc2465f9fca311a91aa' 
  AND (
    token = 'lqGq9zC7RYJc33fw0jmN/1IRJHBOtlZxuRFgmQpbGRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038