UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DVdCUbnxNgqUseJrQXEjRUbDO7JgUErwzLTCr2uu9Fc=' 
WHERE 
  key_id = '2d0af9da22e44062fbad64600c2ef3ff2edaa8038e150eb5d0bc90a4131b479a' 
  AND (
    token = 'DVdCUbnxNgqUseJrQXEjRUbDO7JgUErwzLTCr2uu9Fc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035