UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/8d3xIZ78K6A31eilerYcrTDI0t7smjmp64TEYtWgYM=' 
WHERE 
  key_id = 'c76544c4dff5e99609704b6cb96b1d2d6ac042b4e94c183686d08040233029e0' 
  AND (
    token = '/8d3xIZ78K6A31eilerYcrTDI0t7smjmp64TEYtWgYM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040