UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pCroQWHDfxuJKFoscjTI5jx8EgVznTWv6t47wQA4MAs=' 
WHERE 
  key_id = '55370cdfd6a33cf40248af3c2326118cb40f88733a05aa41346525e7e960d344' 
  AND (
    token = 'pCroQWHDfxuJKFoscjTI5jx8EgVznTWv6t47wQA4MAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043