UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z76LgqbD3nphV+bYvYLqK3GjjLbg5v8cuVuiL+wWD14=' 
WHERE 
  key_id = '24390098a71b9810aac56760e95b9ba64af36d820b6a6a8f07e3509a41c75a8a' 
  AND (
    token = 'z76LgqbD3nphV+bYvYLqK3GjjLbg5v8cuVuiL+wWD14=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045