UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E0FzMc+DOe6W/4qR3H48FYLj1yxBTcMQkbuajI9dtpo=' 
WHERE 
  key_id = '017493ffcada2fce23e69b4b3e9815d7a6c8f868a810f23bf3ae96199c96ef45' 
  AND (
    token = 'E0FzMc+DOe6W/4qR3H48FYLj1yxBTcMQkbuajI9dtpo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033