UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JDFxBCgVv5p70p82aICZgR6nLjXQssDs1x0JlY1vQNU=' 
WHERE 
  key_id = '5656067752e150e76b703b85abbc4f1b8596eaf282f7c9e613002ff95300efa7' 
  AND (
    token = 'JDFxBCgVv5p70p82aICZgR6nLjXQssDs1x0JlY1vQNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023