UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GG50pgdMnRCG6BcRhtGmyEJthdzcbK323YGoQyVIC5M=' 
WHERE 
  key_id = 'cb14a91ebe22df0cecc42b96d76025271af7864cf00e7845047185330ec166ed' 
  AND (
    token = 'GG50pgdMnRCG6BcRhtGmyEJthdzcbK323YGoQyVIC5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034