UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4yM0qR2348Swb2o89wAf0waQAi15dn1mWp3L0/4e6Rs=' 
WHERE 
  key_id = 'cbe30a9a9d68e7a5593f275e0d3139fcd3052de8746ff47ab17b8744cc8debe8' 
  AND (
    token = '4yM0qR2348Swb2o89wAf0waQAi15dn1mWp3L0/4e6Rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035