UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wWnH6eXPg2wy9ZkrsE/tY2meVYYnb/x3OslMkaX0Znc=' 
WHERE 
  key_id = '7daf8ba2df2c9264d5665d2a1d223b6f47e94a2a9483165e3866f55f07366695' 
  AND (
    token = 'wWnH6eXPg2wy9ZkrsE/tY2meVYYnb/x3OslMkaX0Znc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043