UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J/NZu32qIqrbcTKQATB/mP42eqfFO73pHglp9HK5cuc=' 
WHERE 
  key_id = 'ed0c88ff6395139d828fa770ee5e44457191fdc450a04e37c77bbde6ac993d13' 
  AND (
    token = 'J/NZu32qIqrbcTKQATB/mP42eqfFO73pHglp9HK5cuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027