UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm33Phqg/0c2Y1E2wNxb2DhzAstqPkN11+fwKfqs8V9U=' 
WHERE 
  key_id = '7b846dd5f825f557b09ca53e164baae4a142a5c5d5f7d6f7e0b10c79e9f45e87' 
  AND (
    token = 'm33Phqg/0c2Y1E2wNxb2DhzAstqPkN11+fwKfqs8V9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030