UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UB4UEIU6MNYdkPEUQ3sCbk/TzjqJP+vRibs/pnGzeGM=' 
WHERE 
  key_id = '00af8100955247df7bed5e4afff11e06733ff95f24819aecc248122c784f7c9c' 
  AND (
    token = 'UB4UEIU6MNYdkPEUQ3sCbk/TzjqJP+vRibs/pnGzeGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047