UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AUfdN8M+jR4nZS8EbSdXJ1ndFH74dapTJJVZNyMBBdU=' 
WHERE 
  key_id = 'efebc59a6ff075ff5c98f151af5dc312de71239d86454f789cbfd8103075bbb3' 
  AND (
    token = 'AUfdN8M+jR4nZS8EbSdXJ1ndFH74dapTJJVZNyMBBdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037