UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LuifgI26olUqUjphGcG+LdaT001N2X7PQ+zZFQG5s9M=' 
WHERE 
  key_id = '4023f48a345a8a817f87b82c9c4e9447124cfd01370f5e6a8046aae398291856' 
  AND (
    token = 'LuifgI26olUqUjphGcG+LdaT001N2X7PQ+zZFQG5s9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039