UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PVA0w8wqCiktLciOH9lcA+EY5/k06h/qm527DiiW53g=' 
WHERE 
  key_id = '83e7648a875d535f478c6e9e17d8723784519576141402910226509698cc7e3c' 
  AND (
    token = 'PVA0w8wqCiktLciOH9lcA+EY5/k06h/qm527DiiW53g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032