UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GuBbq/t6lfPnFn2X+aChFmbthEE65x0hV/QccyL3huE=' 
WHERE 
  key_id = '87713ac5fe5332ee15d6dbe684a418ded089a93a7dfc48c2c4666f0ebceb0eed' 
  AND (
    token = 'GuBbq/t6lfPnFn2X+aChFmbthEE65x0hV/QccyL3huE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039